//    Copyright (C) Kherty.  All rights reserved.
#region

using System.Diagnostics.Contracts;
using System.Windows.Media.TextFormatting;

#endregion

namespace OpenLS.Spreadsheet.UI.Internals
{
    internal class CellTextRun
    {
        private readonly TextRunProperties _properties;
        private readonly string _text;

        public CellTextRun(string text, TextRunProperties properties)
        {
            Contract.Requires(text != null);
            Contract.Requires(properties != null);
            Contract.Assert(properties != null);
            _text = text;
            _properties = properties;
        }

        public string Text
        {
            get { return _text; }
        }

        public int Length
        {
            get { return _text.Length; }
        }

        public TextRunProperties Properties
        {
            get { return _properties; }
        }

        public TextCharacters GetTextCharacters()
        {
            return new TextCharacters(_text, _properties);
        }
    }
}